'use client';

import React from 'react';
import { useAuth } from '@/hooks/useAuth';
import { Button } from '@/components/ui/Button';

export default function DashboardPage() {
  const { user, logout } = useAuth();

  const handleLogout = async () => {
    await logout();
  };

  return (
    <div className="min-h-screen bg-gray-100">
      <header className="bg-white shadow">
        <div className="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8 flex justify-between items-center">
          <h1 className="text-3xl font-bold text-gray-900">仪表板</h1>
          <div className="flex items-center space-x-4">
            <span className="text-gray-700">欢迎, {user?.name}</span>
            <Button
              variant="outline"
              onClick={handleLogout}
            >
              退出登录
            </Button>
          </div>
        </div>
      </header>
      <main>
        <div className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
          <div className="px-4 py-6 sm:px-0">
            <div className="border-4 border-dashed border-gray-200 rounded-lg h-96 p-4 flex flex-col justify-center items-center">
              <h2 className="text-2xl font-semibold text-gray-700 mb-4">欢迎使用通用管理系统</h2>
              <p className="text-gray-500 mb-8 text-center max-w-md">
                这是一个基于 Next.js + TailwindCSS 构建的通用管理系统框架，包含用户认证、状态管理、路由控制等功能。
              </p>
              <div className="grid grid-cols-1 md:grid-cols-3 gap-4 w-full max-w-2xl">
                <div className="bg-white p-4 rounded shadow">
                  <h3 className="font-medium text-gray-700">用户认证</h3>
                  <p className="text-sm text-gray-500">基于 JWT 的完整认证系统</p>
                </div>
                <div className="bg-white p-4 rounded shadow">
                  <h3 className="font-medium text-gray-700">状态管理</h3>
                  <p className="text-sm text-gray-500">使用 Zustand 的高效状态管理</p>
                </div>
                <div className="bg-white p-4 rounded shadow">
                  <h3 className="font-medium text-gray-700">响应式设计</h3>
                  <p className="text-sm text-gray-500">基于 TailwindCSS 的现代 UI</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </main>
    </div>
  );
} 